const express = require('express');
const router = express.Router();
/* enter a room. */


module.exports = roomController => {
  return router.get('/:roomID', (req, res, next) => {
    const roomID = Number(req.params.roomID);
    const fileName = roomController.getRooms()
      .find(elem => elem.id === roomID)
      .fileName;
    console.log(fileName);
    res.render('room', {
      title: `room-${roomID}`,
      fileName
    });
  });
}
